#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
#define rep(i,l,r) for(int i=(l),i##end=(r);i<=i##end;++i)
#define per(i,r,l) for(int i=(r),i##end=(l);i>=i##end;--i)
#define int long long
#define double long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rbtree(way) tree<way,null_type,less<way>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
const int maxn=1e6+10,maxm=1e6+10,mod=998244353,inf=INT_MAX;
inline int ksm(int x,int k,int mod=mod){
	int ans=1;
	for(;k;k>>=1,x=x*x%mod) if(k&1) ans=ans*x%mod;
	return ans;
}

int n,m,ans[10],p[maxn],f[maxn];
string s,s1;
set<int> t[5];
vector<int> e[maxn];

signed main(){
	freopen("seq.in","r",stdin),freopen("seq.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>s>>s1,n=s.size()+1,m=s1.size()+1,s=' '+s+'0',s1=' '+s1+'0';
	rep(i,2,n) p[i]=s[i]==s[i-1]?p[i-1]:i;
	per(i,n,2) swap(p[i],p[i-1]),p[i]=max(p[i]-1,0ll);
	p[1]=0;
	rep(i,1,n) e[p[i]].pb(i);
	for(int x:e[0]) t[s[x]-'0'].insert(x);
	rep(i,1,m){
		if(!t[s1[i]-'0'].size()||t[s1[i]-'0'].upper_bound(n-m+i)==t[s1[i]-'0'].begin())
			return cout<<"NO",0;
		f[i]=*prev(t[s1[i]-'0'].upper_bound(n-m+i));
		if(f[i]<=f[i-1]) return cout<<"NO",0;
		rep(j,f[i-1]+1,f[i]) for(int x:e[j]) t[s[x]-'0'].insert(x);
	}
	cout<<"YES\n";
	rep(i,1,m-1) cout<<f[i]<<' ';
	return 0;
}
